const path = require('path')
const webpack = require('webpack');
// Add support for Phaser webpack build.
const phaserModule = path.join(__dirname, '/node_modules/phaser-ce/build/custom/');
const pixi = path.join(phaserModule, 'pixi.js');
const phaser = path.join(phaserModule, 'phaser-arcade-physics.js');

module.exports = {
    mode: "production",
    entry: {
        app: [
            // './src/js/config.js',
            './src/js/scene.js',
            './src/js/game.js', 
        ],
        // vendor: [
        //   'pixi',
        //   'phaser',
        // ],
    },
    output: {
        filename: '[name].js?[chunkhash]',
        path: path.resolve(__dirname, './dist'),
        publicPath: './dist/',
    }, 
    module: {
        rules: [
            {
                test: /(phaser-arcade-physics|pixi).js$/,
                use: 'script-loader'
            }
        ]
    },
    resolve: {
      alias: {
        'phaser': phaser,
        'pixi.js': pixi,
        assets: path.join(__dirname, './src/assets'),
      },
    },
    
}
